const Koa = require("koa");
const app = new Koa();
const Router = require('koa-router');
const cors = require("koa2-cors");
const router = new Router();
const bodyParser = require("koa-bodyparser");
app.use(bodyParser());
app
  .use(router.routes())
  .use(router.allowedMethods());
app.use(cors());
router.post("/login", async ctx => {
  const data = ctx.request.body;
  ctx.body = {
    success: true,
    message: "登录成功",
    data
  }
})
app.use(async ctx => {
    ctx.body = "ok";
})
console.log("localhost:5000");
app.listen(5000);